package com.vitabuybuy.tv.dialog

import android.graphics.Color
import androidx.recyclerview.widget.RecyclerView
import com.vitabuybuy.tv.R
import com.vitabuybuy.tv.databinding.ItemBrandBinding
import com.vitabuybuy.tv.dto.BrandDto
import com.library.common.base.BindRecycAdapter


/**
 * 筛选品牌列表适配器
 */
class BrandListAdapter : BindRecycAdapter<ItemBrandBinding, BrandDto>() {
    override fun onBindViewHolder(
        mBinding: ItemBrandBinding,
        itemData: BrandDto,
        holder: RecyclerView.ViewHolder,
        position: Int
    ) {
        mBinding.btnBrand.apply {
            text= itemData.name
            if (itemData.isChoose) {
                setBackgroundResource(R.drawable.rect_0_all_none_red)
                setTextColor(Color.parseColor("#E23225"))
            } else {
                setBackgroundResource(R.drawable.rect_0_all_none_gray)
                setTextColor(Color.parseColor("#909399"))
            }
        }
    }

    override fun normalViewId(viewType: Int): Int {
        return R.layout.item_brand
    }
}